package name.sraynal.msgdispatcher.controller;

import name.sraynal.msgdispatcher.event.Event;
import name.sraynal.msgdispatcher.model.DispatcherModel;
import name.sraynal.msgdispatcher.view.EndView;
import name.sraynal.msgdispatcher.view.FilesView;

public class FileController extends Controller {

	private FilesView filesView;
	private EndView endView;

	public FileController(DispatcherModel model) {
		super(model);
	}

	@Override
	public void sendEvent(Event event) {
		if (event.getType() == Event.FILE_CHOSEN) {
			model.writeToFile();
			displayView(this.endView);
		} else if (event.getType() == Event.SECOND_FILE_DEST) {
			displayView(this.filesView);
		}
	}

	public void setFilesView(FilesView filesView) {
		this.filesView = filesView;
	}

	public void setEndView(EndView endView) {
		this.endView = endView;
	}

}
